﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CollectionsJoin
{
    static class CollectionsJoin
    {
        public static string Join<T>(this ICollection<T> collection)
        {
            string result = "[";
            foreach (var item in collection)
            {
                result = result + item + ",";
            }
            result = result.Substring(0, result.Length - 1);
            result += "]";
            return result;
        }

        static void Main(string[] args)
        {
            List<int> colect = new List<int>();
            colect.Add(1);
            colect.Add(21);
            colect.Add(3);
            colect.Add(5);
            colect.Add(14);

            string result = colect.Join();
            Console.WriteLine(result);
        }
    }
}
